<%@ page language="java" import="java.util.*,bookshop.config.VersionInfo" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>    
    <title>DDC 图书总汇</title>    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link rel="stylesheet" type="text/css" href="<c:url value="/css/application.css" />">
    <link rel="stylesheet" type="text/css" href="<c:url value="/css/shop_main.css" />">
    <link rel="stylesheet" type="text/css" href="<c:url value="/css/listdata.css"></c:url>">
    <link rel="stylesheet" type="text/css" href="<c:url value="/css/form.css"></c:url>">
    
    <script type="text/javascript" src="<c:url value="/js/common.js"/>"></script>
    <%int a=0; %>
    <script type="text/javascript">
    
          function logout() {
			if(confirm("您真的要离开当当网吗?")) {
				location.href="<c:url value="/customer?act=logout"/>";
			 }
	       }
          
          function doQuery(pageno)
         {
            if(pageno<1 || pageno>${page.totalPageNum})
            {
              alert("页号超出范围，有效范围：[1-${page.totalPageNum}]!");
              ${'pageNo'}.select();
              return;
            }
            
            var d=document.forms["qrybook"];
            d.action=d.action+"?pageNo="+pageno;
            d.submit();
            
         }
         
         function PriceSequence(type){
            var p = document.forms["qrybook"];
            p.action=p.action+"?PriceSequence="+type;
            p.submit();
         
         }
    
         function MarkSequence(type){
         var m = document.forms["qrybook"];
            m.action=m.action+"?MarkSequence="+type;
            m.submit();
         
         }
         
         
    </script>
  </head>
  
  <body>
   <div id="allcontent">
    <DIV class=head_container>
       <DIV class=head_welcome style="color:green;font-size:12;">
			<SPAN class=head_toutext id=nickname style="color:green;font-size:12;"> 
			  <c:if test="${empty loginedCustomer }">
				您好,请
				 <A href="<c:url value="/customer?act=toLogin" />"  style="color:green;font-size:12;">登录</A>
				 <A href="<c:url value="/customer?act=input_customer" />"  style="color:green;font-size:12;">免费注册</A>
    		  </c:if>
    		  <c:if test="${not empty loginedCustomer}">
    		    ${loginedCustomer.customerName},欢迎登录当当网！
    		    [<SPAN onclick="logout();" style="cursor:hand;color:green"  style="color:green;font-size:12;">退出系统</SPAN>]
    		  </c:if>
			</SPAN>
			<div class="cart gray4012">
				 <A href="<c:url value="/shoppingcart?act=showShoppingCart" />"  style="color:green;font-size:12;">购物车</A>
			</div>
			<DIV class=little_navi>
				<FORM id=bootpagetopSearch name=bootpagetopSearch
					action="" method=get>
					<DIV class=little_n> 
					    <A href="<c:url value="/myDD?act=showMyDD" />" target=mydangdang name=mydangdang  style="color:green;font-size:12;">我的当当</A> 
					</DIV>
				</FORM>
			</DIV>
			<P class=welcome_p id=nickname></P>
    	</DIV>
		<DIV class=head_head_list >
			<DIV class=head_head_list_left>
				<SPAN class=head_logo> 
					<A href="<c:url value="/workflow?act=mainscreen" />" name=backtobook>
						<IMG src="<c:url value="/pics/front/book_logo.gif" />"> 
					</A> 
				</SPAN>
			</DIV>
			<DIV class=head_head_list_right>
				<DIV class=head_lianjie>
					<IMG class=head_lianjie1 src="<c:url value="/pics/front/bg_book.gif" />">
					<A href="<c:url value="/workflow?act=mainscreen" />" name=backtobook>
					   <IMG src="<c:url value="/pics/front/book_dangdang.gif" />" border=0>
				    </A>
				</DIV>
			</DIV>
		</DIV>
		<DIV class="head_search_div head_search_1" >
			<INPUT class=head_search_kuang id=key_S name=key>
			<SPAN class=head_button >
				<A name=search_book>
					<IMG onclick="" src="<c:url value="/pics/front/button.gif" />" border=0>
				</A>
			</SPAN>
		</DIV>
		<DIV class=head_search_bg></DIV>		    	
    </DIV>
    <DIV class=your_position>
		<DIV style="BORDER-LEFT: #9bb17e 1px solid; BORDER-RIGHT: #9bb17e 1px solid;  WIDTH: 962px; ">
			<A href="#">
				<IMG style="BORDER-TOP: #9bb17e 1px solid; BORDER-BOTTOM: #9bb17e 1px solid;" 
					 src="<c:url value="/pics/front/ncz090505_button02.jpg" />" border=0>
			</A>
		</DIV>
		<DIV style="PADDING-LEFT: 22px; MARGIN-TOP: 5px; MARGIN-BOTTOM: 5px;">
			您现在的位置：
			<SPAN style="COLOR: #cc3300">${currentCtg.ctgName} (${currentCtg.ctgBookAccount}种)</SPAN>
		</DIV>
	</DIV>
	<DIV class=list>
         <DIV class=list_left>
			<DIV class=second_l_border2>
				<H2 id=h2CatalogTitle>类别列表</H2>
				<DIV class=list_menu>
				    <c:forEach var="ctg" items="${ctgs}">
					      <DIV class=second_fenlei2 title="${ctg.ctgName}" >
						        <c:if test="${ctg.ctgId==currentCtg.ctgId}">
							      <DIV class=second_fenlei3>· ${ctg.ctgName} (${ctg.ctgBookAccount}种) </DIV>
							    </c:if>
                               <c:if test="${ctg.ctgId!=currentCtg.ctgId}">                  
						      · <A href="<c:url value="/workflow?act=showBooksByCtg&ctgId=${ctg.ctgId}"/>" 
						      		name=linkCategory>${ctg.ctgName} (${ctg.ctgBookAccount}种)</A> 
					           </c:if> 
                         </DIV>
				    </c:forEach>
				</DIV>
			</DIV>
		</DIV>	
	     <DIV class=list_right id=divRight>
	     <form action="<c:url value="/workflow"/>" method="post" name="qrybook">
          <input type="hidden" name="act" value="showBooksByCtg">
          <input type="hidden" name="ctgId" value="${currentCtg.ctgId}">
	        <div>
                     图书编号：<input type="text" class="text" name="qryBookCode" size="20" value="${param['qryBookCode']}"/>&nbsp;&nbsp;
                     图书名称：<input type="text" class="text" name="qryBookName" size="20" value="${param['qryBookName']}"/>&nbsp;&nbsp;
                      出版社：<input type="text" class="text" name="qryBookPublisher" size="20" value="${param['qryBookPublisher']}"/>&nbsp;&nbsp;</br>
            出版年份： <input type="text" style="border: 1px solid #39c;" size="2" name="qryBookPubYearLeft"value="${param['qryBookPubYearLeft']}"/>
          --&nbsp;<input type="text" style="border: 1px solid #39c;" size="2" name="qryBookPubYearRight"value="${param['qryBookPubYearRight']}"/>&nbsp;&nbsp;
          
          评分：    <span class="linkspan" onclick="MarkSequence('up')">升序</span>&nbsp;
          <span class="linkspan" onclick="MarkSequence('down')">降序</span>&nbsp;&nbsp;
               价格：    <span class="linkspan" onclick="PriceSequence('up')">升序</span>&nbsp;
          <span class="linkspan" onclick="PriceSequence('down')">降序</span>&nbsp;
          
               
          <input type="text" style="border: 1px solid #39c;" size="2" name="qryBookPriceLeft"value="${param['qryBookPriceLeft']}"/>
          --&nbsp;<input type="text" style="border: 1px solid #39c;" size="2" name="qryBookPriceRight"value="${param['qryBookPriceRight']}"/>
       <input style="margin-left: 500px;cursor: hand;" type="submit"  value="查询"></br>
         
         
       </div>
         
         <div align="right" > 
         <img src="<c:url value="pics/front/page_up_mouseover.gif" />" onclick="doQuery(${page.pageNo-1})" style="margin-right: 10px;cursor: hand;"/>
         <img src="<c:url value="pics/front/page_down.gif"/>" onclick="doQuery(${page.pageNo+1})" style="margin-right: 10px;cursor: hand;"/></div>
       </form>
            <c:forEach var="book" items="${page.pageContent}">
				<DIV class=list_r_list>
					<SPAN class=list_r_list_book>
						<A class=book_pic_x href="#" name=link_prd_img>
						  <IMG style="width:90px;height:90px;" alt=${book.bookName} src="<c:url value="/workflow?act=showcover&bookcode=${book.bookCode}" />">
						</A>
						<br/>
						<c:forEach items="${sales}" var="sale"><c:if test=""></c:if>   </c:forEach>
						<span> 销量:<c:forEach items="${sales}" var="sale"><c:if test="${sale.book.bookCode==book.bookCode}">${sale.number}<% a=1; %></c:if></c:forEach>
						<% if(a==0){ %><%=a%><% } %>本</span>
						<% a=0; %>
					</SPAN>
					<H2>
						<A href="<c:url value="/workflow?act=showBookByCode&bookCode=${book.bookCode}" />" name=link_prd_name>${book.bookName}</A>
					</H2>
					<H3>
						顾客评分：
						<c:if test="${book.bookMark==0}">目前暂无评分</c:if>
						<c:if test="${book.bookMark!=0}">
							<c:choose>
						      <c:when test="${book.bookMark==1}">
						         <IMG src="<c:url value="/pics/front/star_red.gif"/>">
						      </c:when>
						      <c:when test="${book.bookMark==2}">
							      <IMG src="<c:url value="/pics/front/star_red.gif"/>">
							      <IMG src="<c:url value="/pics/front/star_red.gif"/>">
						      </c:when>
						      <c:when test="${book.bookMark==3}">
							      <IMG src="<c:url value="/pics/front/star_red.gif"/>">
							      <IMG src="<c:url value="/pics/front/star_red.gif"/>">
							      <IMG src="<c:url value="/pics/front/star_red.gif"/>">
						      </c:when>
						      <c:when test="${book.bookMark==4}">
							      <IMG src="<c:url value="/pics/front/star_red.gif"/>">
							      <IMG src="<c:url value="/pics/front/star_red.gif"/>">
							      <IMG src="<c:url value="/pics/front/star_red.gif"/>">
							      <IMG src="<c:url value="/pics/front/star_red.gif"/>">
						      </c:when>
						      <c:when test="${book.bookMark==5}">
							      <IMG src="<c:url value="/pics/front/star_red.gif"/>">
							      <IMG src="<c:url value="/pics/front/star_red.gif"/>">
							      <IMG src="<c:url value="/pics/front/star_red.gif"/>">
	                              <IMG src="<c:url value="/pics/front/star_red.gif"/>">
	                              <IMG src="<c:url value="/pics/front/star_red.gif"/>">
						      </c:when>
						    </c:choose>						  						 
						</c:if>
					</H3>
					<H4 class=list_r_list_h4>
						图书作者：
						<A href="#" name=作者>${book.bookAuthor}</A> 等编著
					</H4>
					<H4>
						出 版 社：
						<A href="#" name=出版社>${book.bookPublisher}</A>
					</H4>
					<H4>
						出版时间：
						 <fmt:formatDate value="${book.bookPubDate}" pattern="yyyy年MM月dd日"/>  
					</H4>
					<H4>
						摘要信息：<br/>&nbsp;&nbsp;&nbsp;&nbsp;${book.bookDesc}
					</H4>
					<DIV class=clear></DIV>
					<H6>
						<SPAN class=red style="MARGIN-RIGHT:35px">单价:￥<fmt:formatNumber value="${book.bookPrice}" pattern="0.00"/></SPAN>
					</H6>
					<SPAN class=list_r_list_button>
						<A  target="_blank" href="<c:url value="/shoppingcart?act=addBookToCart&bookcode=${book.bookCode}"/>" name=link_sale><IMG
							onmousedown='' onmouseover='' title=购买 onmouseout='' src="<c:url value="/pics/front/buttom_goumai.gif" />">
					</A>
					</SPAN>
					<SPAN class=list_r_list_button><A
						href="<c:url value="/tempstore?act=add_temp&bookcode=${book.bookCode}"/>" name=link_favorlist target="_blank"><IMG
							onmousedown='' onmouseover='' title=放入暂存架 onmouseout='' src="<c:url value="/pics/front/buttom_zancun.gif" />">
					</A>
					</SPAN>
				</DIV>
			</c:forEach>	     
	     </DIV>
	     <div id="pageinfo" style="float:right; margin:5px; padding-right:3px;">
		            共${page.totalRecNum}条, 当前显示${page.startIndex+1}-${page.endIndex}条, 第${page.pageNo}/${page.totalPageNum}页
		           |
		           <c:if test="${page.pageNo>1}">
		             <span class="linkspan" onclick="doQuery(1)">首页</span>&nbsp;
		           </c:if>
		           <c:if test="${page.prePage}">
		             <span class="linkspan" onclick="doQuery(${page.pageNo-1})">上一页</span>&nbsp;
		           </c:if>
		           <c:if test="${page.nextPage}">
		             <span class="linkspan" onclick="doQuery(${page.pageNo+1})">下一页</span>&nbsp;
		           </c:if>
		           <c:if test="${page.pageNo!=page.totalPageNum}">
		             <span class="linkspan" onclick="doQuery(${page.totalPageNum})">末页</span>&nbsp;
		           </c:if>
		           |
		            到<input type="text" id="pageNo" size=4 style="text-align:right;" onkeypress="onlynumber();"/> 页
		           <button onclick="doQuery($('pageNo').value);"> 跳 转 </button>		           		           	           	              
		        </div>
 
	     
	</DIV>
	
	<div style="clear:both;"></div>
    <div id="footer" style="margin-top:20px;width:950px;border-top:1px solid; COLOR: #404040;COLOR: #666; text-align:center; background-color:#fff;font-size:12px;">
          <%=VersionInfo.buildFooterStr()%>       
    </div>
   </div>
  </body>
</html>
